package net.turnbig.wechat.bot.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PatternUtils {

	public static String getGroup(String source, String pattern) {
		return getGroup(source, pattern, 1);
	}

	public static String getGroup(String source, String pattern, int group) {
		Pattern p = Pattern.compile(pattern);
		Matcher m = p.matcher(source);
		if (m.find()) {
			return m.group(group);
		}
		return null;
	}

}
